package com.qyp.content.filter;

import com.alibaba.csp.sentinel.adapter.servlet.CommonFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

/**
 * @author admin
 */
@Configuration
public class ComponentFilterConfig {

    /**
     * 1024  不起作用 ，等待官网发布1.7版本
     * @return
     */
    //@Bean
    public FilterRegistrationBean sentinelFilterRegistrationNew() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new MySentinelCommonFilter());
        registration.addUrlPatterns("/*");
        //registration.addInitParameter(CommonFilter.WEB_CONTEXT_UNIFY, "false");
        registration.setName("sentinelFilterNew");
        registration.setOrder(1);

        return registration;
    }
}
